package samber

import (
	"fmt"
	"github.com/samber/lo"
)

// OmitBy 给Map进行过滤
func OmitBy() {
	kv := map[string]int{"foo": 1, "bar": 2, "baz": 3}

	result := lo.OmitBy(kv, func(key string, value int) bool {
		return value%2 == 1
	})
	fmt.Printf("%v \n", result) // map[bar:2]
}

func OmitByKeys() {
	kv := map[string]int{"foo": 1, "bar": 2, "baz": 3}

	result := lo.OmitByKeys(kv, []string{"foo"})

	fmt.Printf("%v \n", result) // map[bar:2 baz:3]
}

func OmitByValues() {
	kv := map[string]int{"foo": 1, "bar": 2, "baz": 3}

	result := lo.OmitByValues(kv, []int{3})

	fmt.Printf("%v \n", result) // map[bar:2 foo:1]
}
